package com.klei.service.impl;

import com.klei.dao.ICarDao;
import com.klei.pojo.Car;
import com.klei.service.ICarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarServiceImpl implements ICarService {

    @Autowired
    private ICarDao carDao;

    @Override
    public List<Car> getAllCar() {
        return carDao.getAllCar();
    }

    @Override
    public List<Car> getCarByCid(int cid) {
        return carDao.getCarByCid(cid);
    }

    @Override
    public List<Car> getCarByRedu(int cid) {
        return carDao.getCarByRedu(cid);
    }

    @Override
    public List<Car> getCarByPage(int page, int limit) {
        return carDao.getCarByPage(page, limit);
    }

    @Override
    public Car getCarById(int id) {
        return carDao.getCarById(id);
    }

    @Override
    public int getCarCount() {
        return carDao.getCarCount();
    }

    @Override
    public boolean updateCarNumber(int id) {
        return carDao.updateCarNumber(id) > 0;
    }

    @Override
    public boolean updateCar(Car car) {
        return carDao.updateCar(car) > 0;
    }

    @Override
    public boolean insertCar(Car car) {
        return carDao.insertCar(car) > 0;
    }

    @Override
    public boolean deleteCar(int id) {
        return carDao.deleteCar(id) > 0;
    }
}
